$(function () {
    setProduct();
    setProducts();
})

//查询全部工程案例的类型
function setProduct() {
    let data=myAjax("/page/productFindAll","","get");
    data=data.list;
    let html='';
    for (let i=0; i<data.length; i++){
        html +='<div class="navigation" onclick="window.open(\'engineering.html\',\'_self\')">\n' +
            '            <div class="productLogo"><img src="'+data[i].imgHref+'"/></div>\n' +
            '            <div><p>'+data[i].casetypename+'</p></div>\n' +
            '            <div><p>'+data[i].content+'</p></div>\n' +
            '        </div>';
    }
    $("#productFind").html(html);
}

//查询全部工程案例
function setProducts() {
    let data=myAjax("/page/producatspageFindAll","","get");
    data=data.list;
    let html='';
    for (let i=0; i<data.length;i++){
        html +='<div>\n' +
            '                <div  onclick="selectProductById('+data[i].id+')"  class="productimg navigation" ><img src="'+data[i].imgHref+'"/></div>\n' +
            '                <div><p>'+data[i].title+'</p></div>\n' +
            '            </div>';
    }
    $('#productsFind').html(html);
}

function selectProductById(id) {
    window.open("engineeringDetailed.html","_self");
    localStorage.setItem("productId",id);
}